package cn.wolfcode.service;

import cn.wolfcode.domain.OperateIntergralVo;
import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;


@LocalTCC
public interface IUsableIntegralService {
    Boolean decrIntegral(OperateIntergralVo operateIntergralVo);

    Boolean incrIntegral(OperateIntergralVo operateIntergralVo);

    /**
     * 增加积分
     */
    @TwoPhaseBusinessAction(name = "incrIntergralTry", commitMethod = "incrIntergralCommit", rollbackMethod = "incrIntergralRollback")
    Boolean incrIntergralTry(@BusinessActionContextParameter(paramName = "operateIntergralVo") OperateIntergralVo operateIntergralVo, BusinessActionContext context);
    Boolean incrIntergralCommit(BusinessActionContext context);
    Boolean incrIntergralRollback(BusinessActionContext context);

    /**
     * 减少积分
     */
    @TwoPhaseBusinessAction(name = "decrIntergralTry", commitMethod = "decrIntergralCommit", rollbackMethod = "decrIntergralRollback")
    Boolean decrIntergralTry(@BusinessActionContextParameter(paramName = "operateIntergralVo") OperateIntergralVo operateIntergralVo, BusinessActionContext context);
    Boolean decrIntergralCommit(BusinessActionContext context);
    Boolean decrIntergralRollback(BusinessActionContext context);
}
